home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / knowhow4 / work.bas < prev    next >
BASIC Source File  |  1994-05-30  |  2KB  |  99 lines

  1. & Initialization
  2. ARRAY[12];
  3. X = 1
  4. STRING = "Hello"
  5.  
  6. FOR j = 1 TO 10
  7.     ARRAY[j] = j
  8.     PRINT "ARRAY[j] = ", ARRAY[j];
  9. NEXT
  10.  
  11. FOR i = 1 TO 10
  12.     @sub(ARRAY[i], i)
  13. NEXT
  14.  
  15. PRINT "";
  16. PRINT "";
  17.  
  18. INPUT "Input ARRAY[2]: ", ARRAY[2];
  19. PRINT ARRAY[2];
  20. INPUT "Input REAL X: ", X;
  21. PRINT X;
  22.  
  23. INPUT "Input STRING: ", STRING;
  24. PRINT STRING;
  25.  
  26. ARRAY[3] = ARRAY[2]
  27. PRINT ARRAY[3];
  28.  
  29. GOTO label
  30. PRINT "No label jump";
  31. !label
  32. PRINT "Label jump";
  33.  
  34. & x = 1
  35. & x = SPECIAL(5, 6)
  36. & PRINT x;
  37.  
  38.  
  39. PRINT "                           Parent SLANG class operators: ";
  40.  
  41. k = 1
  42. PRINT " INPUT < Quoted commentaries >, Variable (previously assigned) ";
  43. INPUT "Input k > 10, k < 40: ", k;
  44.  
  45. PRINT "";
  46. PRINT "";
  47.  
  48. PRINT "PRINT <Quoted string or variables >, ... ; means new line";
  49.  
  50. PRINT "";
  51. PRINT "";
  52.  
  53. PRINT "FOR x = start value TO end value";
  54. PRINT "...........CYCLE BODY...........";
  55. PRINT "NEXT";
  56.  
  57. FOR j = 1 TO k
  58.     PRINT " j = ", j;
  59. NEXT
  60.  
  61. PRINT "";
  62. PRINT "";
  63.  
  64. PRINT "IF Expression Condition Expression THEN Task";
  65. PRINT "If Condition is TRUE, we execute Task, else - pass control to";
  66. PRINT "the next line";
  67.  
  68. PRINT "";
  69. PRINT "";
  70.  
  71. PRINT "@sub(arguments) is the subroutine call. We put subroutines after ";
  72. PRINT "END operator at the end of main part of the program:";
  73. PRINT "END";
  74. PRINT "@sub(a, b)";
  75. PRINT "......Subroutine body..........";
  76. PRINT " RETURN <argument>";
  77. PRINT "<argument> will be assigned to the 'retval' variable";
  78.  
  79. FOR i = 1 TO k
  80.     @sub(i, k - i)
  81. NEXT
  82.  
  83. PRINT "PLAY External file name executes program from another file";
  84.  
  85. PLAY "WORK1.BAS"
  86.  
  87. END
  88.  
  89. &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& FUNCTIONS &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
  90.  
  91. @sub(a, b)
  92.     PRINT " a = ", a, " b = ", b;
  93. RETURN
  94.  
  95.  
  96.  
  97.  
  98.  
  99.